﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LogIn.ascx.cs" Inherits="LogIn" %>
<script runat="server">
    public string MaNgauNhien_SoChu(int codeCount)

        {

            string allChar ="0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
            string[] allCharArray = allChar.Split(',');
            string randomCode = "";
            int temp = -1;
            Random rand = new Random();
            for (int i = 0; i < codeCount; i++)
                {
                    if (temp != -1)
                        {
                            rand = new Random(i * temp * ((int)DateTime.Now.Ticks));
                        }
                    int t = rand.Next(36);
                    if (temp != -1 && temp == t)
                        {
                            return MaNgauNhien_SoChu(codeCount);
                        }
                    temp = t;
                    randomCode += allCharArray[t];
                }
            return randomCode;

        }
    protected void zz(object sender, System.EventArgs e)
    {
        num.Text = MaNgauNhien_SoChu(5);
    }
    </script>
<link rel="stylesheet" type="text/css" href="Style/style.css" />
<style type="text/css">
    .style1
    {
        color: #0000FF;
    }
    .style3
    {
        width: 129px;
    }
</style>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
    <tr>
        
        <td bgcolor="#3b5998" style="width: 685px;font-size:large" align="left" id="textmenu">
            Đăng nhập</td>
        
    </tr>
    <tr>
        <td id="bordermenu" align="center" background="Images/bg-contexnd.jpg" colspan="3" style="height: 15px;padding: 10px 0 10px 0;" valign="middle">            
            <asp:Panel ID="Panel1" runat="server" Width="400px" BorderColor="#A62800" 
                BorderStyle="Inset" DefaultButton="btnLogIn" Height="181px">
                <table border="0" cellpadding="0" cellspacing="0" style="width:100%">
                        
                    <tr>
                     <td align="center">
                         <b><span class="style1">Hãy nhập số này vào thiết bị của bạn </span></b>
                         </td>
                        <tr>
                            <td align="center">
                                <asp:TextBox ID="num" runat="server" align="center" AutoPostBack="true" 
                                    OnLoad="zz"></asp:TextBox>
                            </td>
                        </tr>
                     </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                
                     <tr>

                         <td ID="text" align="right" class="style3" style="font-weight:bolder;">
                             Tên đăng nhập</td>
                         <td style="width: 200px; height: 30px;">
                             <asp:TextBox ID="txtUserName" runat="server" BackColor="ControlLight" 
                                 BorderColor="#A62800" BorderStyle="Inset" ForeColor="#A62800"></asp:TextBox>
                         </td>
                     <tr>
                         <td ID="text" align="right" class="style3" style="font-weight:bolder;">
                             Mật khẩu OTP</td>
                         <td style="width: 200px; height: 30px;">
                             <asp:TextBox ID="txtPassword" runat="server" BackColor="ControlLight" 
                                 BorderColor="#A62800" BorderStyle="Inset" ForeColor="#A62800" 
                                 TextMode="Password"></asp:TextBox>
                         </td>
                     </tr>
                     <tr>
                         <td class="style3">
                         </td>
                         <td style="width: 200px; height: 30px;">
                             <asp:Button ID="btnLogIn" runat="server" BackColor="#4b6cb1"  Font-Bold="false" ForeColor="White" Width="80px" 
                            BorderStyle="None" DefaultButton="btnLogIn" 
                                  OnClick="btnLogIn_Click" 
                                 Text="Đăng nhập" />
                             <asp:Button ID="btnReset" runat="server" BackColor="#4b6cb1"  Font-Bold="false" ForeColor="White" Width="80px" 
                            BorderStyle="None" 
                                 OnClick="btnReset_Click" Text="Xóa trắng" />
                         </td>
                     </tr>
                     <tr>
                         <td align="center" colspan="2" style="width: 200px; height: 30px">
                             <asp:HyperLink ID="hplCreateAccount" runat="server" 
                                 NavigateUrl="index.aspx?subpara=createaccount">Đăng ký!</asp:HyperLink>
                         </td>
                     </tr>
                </table>
            </asp:Panel>
              
        </td>
    </tr>
</table>
